<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>计算属性有缓存处理,比   方法更加简单</title>
	</head>
	<body>
		
		<div id="app">
			<!-- 进行字符串拼接 -->
			<h1>{{msgComputed}}</h1>
			<h1>{{msgComputed}}</h1>
			<h1>{{msgComputed}}</h1>
			<h1>{{msgComputed}}</h1>
			<h1>{{getMsg()}}</h1>
			<h1>{{getMsg()}}</h1>
			<h1>{{getMsg()}}</h1>
			<h1>{{getMsg()}}</h1>
			
		</div>
		
		
		<script type="text/javascript" src="../js/vue.min.js"></script>
		<script>
			
			const app = new Vue({
				el: "#app",
				data: { 
					id : "110",
					name : "公安局"
				},
				computed: {
					msgComputed : function(){
						console.info("计算属性执行!!!!");
						return this.id + " " + this.name;
					}
					
				},
				methods: {
					getMsg : function(){
						console.log("执行方法!!!!")
						return this.id + " " + this.name;
					}
				}
			});
			
			
		</script>
	</body>
</html>
